package com.eunion.web.cms.entity.report;

import java.io.Serializable;
import java.util.Objects;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.constraints.Size;

import org.apache.commons.lang.StringUtils;

import com.eunion.core.common.domain.AbstractExcelReport;
import com.eunion.core.common.domain.ExcelUploadRecord;

/**
 * 机车检修计划
 */
@Entity
@Table(name = "excel_jxjh_report")
public class ExcelJxjhReport extends AbstractExcelReport implements Serializable {

    private static final long serialVersionUID = 1L;

    public ExcelJxjhReport() {
    }

    public ExcelJxjhReport(ExcelUploadRecord uploadRecord, String jxjhYear, String jxjhMonth, String jxjhRq,
        String jxzx, String dw, String trainTypeNo, String xc) {
        this.setUploadRecord(uploadRecord);
        this.jxjhYear = jxjhYear;
        this.jxjhMonth = jxjhMonth;
        this.jxjhRq = jxjhRq;
        this.jxzx = jxzx;
        this.dw = dw;
        if (StringUtils.isNotEmpty(trainTypeNo)) {
            trainTypeNo = trainTypeNo.trim();
            this.jcxh = trainTypeNo.substring(0, trainTypeNo.length() - 4);
            this.jch = trainTypeNo.substring(trainTypeNo.length() - 4, trainTypeNo.length());
        }
        this.xc = xc;
    }

    /**
     * 检修计划表年份
     */
    @Size(max = 4)
    @Column(name = "jxjh_year", length = 4)
    private String jxjhYear;

    /**
     * 检修计划表月份
     */
    @Size(max = 2)
    @Column(name = "jxjh_month", length = 2)
    private String jxjhMonth;

    /**
     * 序号
     */
    @Column(name = "xh")
    private Long xh;

    /**
     * 检修中心：机辆分公司，黄骅港检修中心，神池南检修中心
     */
    @Size(max = 30)
    @Column(name = "jxzx", length = 30)
    private String jxzx;

    /**
     * 单位：机车分公司（含天津地铁），京铁，四局，十五局，一局，三局，南环，十六局
     */
    @Size(max = 50)
    @Column(name = "dw", length = 50)
    private String dw;

    /**
     * 检修计划日期
     */
    @Size(max = 20)
    @Column(name = "jxjh_rq", length = 20)
    private String jxjhRq;

    /**
     * 机车型号
     */
    @Size(max = 5)
    @Column(name = "jcxh", length = 5)
    private String jcxh;

    /**
     * 机车号
     */
    @Size(max = 4)
    @Column(name = "jch", length = 4)
    private String jch;

    /**
     * 修程
     */
    @Size(max = 20)
    @Column(name = "xc", length = 20)
    private String xc;

    public String getJxjhYear() {
        return jxjhYear;
    }

    public ExcelJxjhReport jxjhYear(String jxjhYear) {
        this.jxjhYear = jxjhYear;
        return this;
    }

    public void setJxjhYear(String jxjhYear) {
        this.jxjhYear = jxjhYear;
    }

    public String getJxjhMonth() {
        return jxjhMonth;
    }

    public ExcelJxjhReport jxjhMonth(String jxjhMonth) {
        this.jxjhMonth = jxjhMonth;
        return this;
    }

    public void setJxjhMonth(String jxjhMonth) {
        this.jxjhMonth = jxjhMonth;
    }

    public Long getXh() {
        return xh;
    }

    public ExcelJxjhReport xh(Long xh) {
        this.xh = xh;
        return this;
    }

    public void setXh(Long xh) {
        this.xh = xh;
    }

    public String getJxzx() {
        return jxzx;
    }

    public ExcelJxjhReport jxzx(String jxzx) {
        this.jxzx = jxzx;
        return this;
    }

    public void setJxzx(String jxzx) {
        this.jxzx = jxzx;
    }

    public String getDw() {
        return dw;
    }

    public ExcelJxjhReport dw(String dw) {
        this.dw = dw;
        return this;
    }

    public void setDw(String dw) {
        this.dw = dw;
    }

    public String getJxjhRq() {
        return jxjhRq;
    }

    public ExcelJxjhReport jxjhRq(String jxjhRq) {
        this.jxjhRq = jxjhRq;
        return this;
    }

    public void setJxjhRq(String jxjhRq) {
        this.jxjhRq = jxjhRq;
    }

    public String getJcxh() {
        return jcxh;
    }

    public ExcelJxjhReport jcxh(String jcxh) {
        this.jcxh = jcxh;
        return this;
    }

    public void setJcxh(String jcxh) {
        this.jcxh = jcxh;
    }

    public String getJch() {
        return jch;
    }

    public ExcelJxjhReport jch(String jch) {
        this.jch = jch;
        return this;
    }

    public void setJch(String jch) {
        this.jch = jch;
    }

    public String getXc() {
        return xc;
    }

    public ExcelJxjhReport xc(String xc) {
        this.xc = xc;
        return this;
    }

    public void setXc(String xc) {
        this.xc = xc;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        ExcelJxjhReport excelJxjhReport = (ExcelJxjhReport) o;
        if (excelJxjhReport.getIdx() == null || getIdx() == null) {
            return false;
        }
        return Objects.equals(getIdx(), excelJxjhReport.getIdx());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getIdx());
    }

}
